// 摄像机

#ifndef ALICE_CAMERA_CAMERA_H_
#define ALICE_CAMERA_CAMERA_H_

#include "SDL.h"

#include "point.h"
#include "vector2d.h"
#include "director.h"

namespace alice {

class Camera {
  public:
    static Camera* GetInstance() {
      return instance_ = (instance_ == nullptr ? new Camera() : instance_);
    }

    SDL_Rect GetViewBox() { return view_box_; }
    Vector2D GetPosition() { return position_; }
    void SetTarget(Point* target) { target_ = target; }
    void Update(double delta_time);

  private:
    Camera() {
      target_ = nullptr;
      view_box_ = {0, 0, kWindowWidth, kWindowHeight};
    }

  private:
    static Camera* instance_;
    Point* target_; // 被跟踪物体的中点坐标。
    Vector2D position_; // 摄像机的位置
    SDL_Rect view_box_; // 视窗矩形
};

}

#endif // !ALICE_CAMERA_CAMERA_H_